<html xmlns="http://www.w3.org/1999/xhtml">
<style>
#svgRoot {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#transformOriginRect {
    fill: green;
    transform: rotate(90deg);
}
.relative {
    transform-box: fill-box;
}
.absolute {
    transform-box: view-box;
}
</style>

<!--
  Test for bug 79068 - SVG should support transform-origin and relative values.

  You should see 9 green 20x20 rectangles.  Each green rectangle is actually one of a set of about 6, each one
  with a different but equivalent value for the CSS transform-origin property.
-->

<body>
  <svg id="svgRoot" xmlns="http://www.w3.org/2000/svg"></svg>

  <script><![CDATA[
    var svgNS = "http://www.w3.org/2000/svg";

    function addTransformOriginRect(x, y, s)
    {
       var rect = document.createElementNS(svgNS, "rect");
       var transformOrigin = (typeof(s) == "string") ? s :  (x + s[0] + "px") + " " + (y + s[1] + "px");
       rect.setAttribute("class", typeof(s) == "string" ? "relative" : "absolute");
       rect.setAttribute("id", "transformOriginRect");
       rect.setAttribute("x", x);
       rect.setAttribute("y", y);
       rect.setAttribute("width", 30);
       rect.setAttribute("height", 30);
       rect.setAttribute("style", "-webkit-transform-origin: " + transformOrigin + ";");
       document.getElementById("svgRoot").appendChild(rect);
    }

    var equivalentTransformOrigins = [
         ["50% 50%", "center 50%", "50% center", "center", "center center", [15, 15]],
         ["0% 0%", "left 0%", "0% top", "left top", "top left", [0, 0]],
         ["0% 50%", "left 50%", "0% center", "left", "left center", "center left", [0, 15]],
         ["100% 0%", "right 0%", "100% top", "right top", "top right", [30, 0]],
         ["0% 50%", "left 50%", "0% center", "left center", "center left", [0, 15]],
         ["100% 50%", "right 50%", "100% center", "right center", "center right", [30, 15]],
         ["0% 100%", "left 100%", "0% bottom", "left bottom", "left bottom", [0, 30]],
         ["50% 100%", "center 100%", "50% bottom", "bottom", "center bottom", "bottom center", [15, 30]],
         ["100% 100%", "right 100%", "100% bottom", "right bottom", "bottom right", [30, 30]]
     ];

     for (var i = 0; i < equivalentTransformOrigins.length; i++)  {
         var x = 60 + (i %  4) * 60;
         var y = 60 + Math.floor(i / 4) * 60;
         equivalentTransformOrigins[i].map( function(s) { addTransformOriginRect(x, y, s); } );
     }

  ]]></script>
</body>
</html>
